package com.shiguo365.market;

import android.support.test.rule.ActivityTestRule;

import com.shiguo365.market.display.activity.MainActivity;

import org.junit.Rule;
import org.junit.Test;

import static android.support.test.espresso.Espresso.onView;
import static android.support.test.espresso.action.ViewActions.click;
import static android.support.test.espresso.assertion.ViewAssertions.matches;
import static android.support.test.espresso.matcher.ViewMatchers.withId;
import static android.support.test.espresso.matcher.ViewMatchers.withText;

/**
 * Created by CoderA on 2016/7/7.
 */
public class MainActivityInstrumentationTest {

    private static final String STRING_TO_BE_TYPED = "Peter";

    @Rule
    public ActivityTestRule<MainActivity> mActivityRule = new ActivityTestRule<>(
            MainActivity.class);

    @Test
    public void foo(){
        //onView(withId(R.id.email)).perform(typeText(STRING_TO_BE_TYPED), closeSoftKeyboard());

        onView(withId(R.id.txt_center)).perform(click());

        String expectedText = "15861339858";
        onView(withId(R.id.phone)).check(matches(withText(expectedText)));
    }
}
